﻿/*-------------------------------------------------------------------------
* 命名空间: XrayDirection.ValueConverters/JsonIndentedConverter 
* 类   名: JsonIndentedConverter
* 功   能: N/A
* 时   间: 2024-08-26 17:59:18
* 版   本: V1.0
* 作   者: Fioman
* 格   言: Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using Newtonsoft.Json;
using System;
using System.Globalization;
using System.Windows.Data;

namespace XrayDirection.ValueConverters
{
    public class JsonIndentedConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return "无消息";
            }
            return JsonConvert.SerializeObject(value, Formatting.Indented);
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
